import React, { Component } from 'react';

// import Pushwarehouse from "./../Warehouse/Pushwarehouse/index.tsx"


import { Table, Button } from 'antd';
import Model from './ui/Model';

// import Model from "@ views/Warehouse/Pushwarehouse/ui/Model.";

const columns = [
  {
    title: '入库日期',
    dataIndex: 'name',
  },
  {
    title: '入库单编号',
    dataIndex: 'age',
  },
  {
    title: '采购单编号',
    dataIndex: 'agec',
  },
  {
    title: '入库状态',
    dataIndex: 'storeState',
  },
  {
    title: '入库类型',
    dataIndex: 'storeType',
  },
  {
    title: '供应商编号',
    dataIndex: 'supply',
  },
  {
    title: '入货仓库',
    dataIndex: 'closedStore',
  },
  {
    title: '收货员',
    dataIndex: 'closed',
  },
  {
    title: '仓管员',
    dataIndex: 'storer',
  },
  {
    title: '操作',
    dataIndex: 'fuck',
  },
];

const data:any = [];
for (let i = 0; i < 46; i++) {
  data.push({
    key: i,
    name: `2017.12.03 ${i}`,
    age:" RK160727154701",
    agec:" GG160727154701",
    address: `待入库 ${i}`,
    storeState:`待入库 ${i}`,
    storeType:`一般入库 ${i}`,
    supply:` 89${i}24`,
    closedStore:` 长江仓库`,
    storer:`李四`,
    closed:`张三`,
    fuck:<Model></Model>,
  });
}


class index extends Component {
    state = {
        selectedRowKeys: [], // Check here to configure the default column
        loading: false,
      };
    
      start = () => {
        this.setState({ loading: true });
        // ajax request after empty completing
        setTimeout(() => {
          this.setState({
            selectedRowKeys:[],
            loading: false,
          });
        }, 1000);
      };
    
      onSelectChange = (selectedRowKeys:any) => {
        console.log('selectedRowKeys changed: ', selectedRowKeys);
        this.setState({ selectedRowKeys });
      };
    
      render() {
        const { loading, selectedRowKeys } = this.state;
        const rowSelection = {
          selectedRowKeys,
          onChange: this.onSelectChange,
        };
        const hasSelected = selectedRowKeys.length > 0;
        return (
          <div style={{width:"100%"}}>
            <div style={{ marginBottom: 12 }}>
              <Button type="primary" onClick={this.start} disabled={!hasSelected} loading={loading}>
                重新加载
              </Button>
              <span style={{ marginLeft: 12 }}>
                {hasSelected ? `选中 ${selectedRowKeys.length} 项` : ''}
              </span>
            </div>
            <Table rowSelection={rowSelection} columns={columns} dataSource={data} bordered  />
          </div>
        );
      }
    
}

export default index;

